package com.jackstraw.jack_base.mq.rocketmq.bean.enums;

import org.apache.rocketmq.client.producer.LocalTransactionState;
import org.apache.rocketmq.spring.core.RocketMQLocalTransactionState;

/**
 * 事务消息事务结果枚举
 */
public enum TransactionStateEnum {

    COMMIT(RocketMQLocalTransactionState.COMMIT, LocalTransactionState.COMMIT_MESSAGE),
    ROLLBACK(RocketMQLocalTransactionState.ROLLBACK, LocalTransactionState.ROLLBACK_MESSAGE),
    UNKNOWN(RocketMQLocalTransactionState.UNKNOWN, LocalTransactionState.UNKNOW),
    ;

    private RocketMQLocalTransactionState rocketMQLocalTransactionState;
    private LocalTransactionState localTransactionState;

    TransactionStateEnum(RocketMQLocalTransactionState rocketMQLocalTransactionState, LocalTransactionState localTransactionState) {
        this.rocketMQLocalTransactionState = rocketMQLocalTransactionState;
        this.localTransactionState = localTransactionState;
    }

    public RocketMQLocalTransactionState getRocketMQLocalTransactionState() {
        return rocketMQLocalTransactionState;
    }

    public LocalTransactionState getLocalTransactionState() {
        return localTransactionState;
    }

}
